package main

import (
    //"fmt"
	"thirdpaysdk/api/hnapay"
	"github.com/astaxie/beego"
	//"io/ioutil"
)

func notifyDemo() {
    notifyStr := `eyJoZWFkIjp7InNlckNvZGUiOiIxMDEwMDUiLCJtZXJDb2RlIjoiMTAwMDAwMDA0NjYiLCJvcmRlcklkIjoiNDA0MzY0MjQ3NjE5ODY2NjI0IiwibWVyRGF0ZSI6IjIwMTkxMDE2IiwibWVyVGltZSI6IjE1MjcyOSIsInZlcnNpb25ObyI6IjIuMCIsInNpZ25UeXBlIjoiMiJ9LCJjb250ZW50Ijp7InJlc3BvbnNlQ29kZSI6IjAwMDAiLCJyZXNwb25zZURlc2MiOiLkuqTmmJPmiJDlip8iLCJtZXJPcmRlcklkIjoiNDA0MzY0MjQ3NjE5ODY2NjI0IiwiZGVhbElkIjoiMTAyMTkxMDE2MTUyNzA3OTYxNSIsInBheVR5cGUiOiI1IiwicGF5ZXJBY2NvdW50IjoiIiwib3JkZXJBbW91bnQiOiI1MTAwMCIsIm9yZGVyQ3VycmVuY3kiOiJDTlkiLCJwYXlBbW91bnQiOiI1MTAwMCIsInBheUN1cnJlbmN5IjoiQ05ZIiwic2V0dGxlQ3VycmVuY3kiOiJDTlkiLCJzdGF0dXMiOiIxIiwiY29tcGxldGVUaW1lIjoiMjAxOTEwMTYxNTI3MjgiLCJwbGF0Zm9ybUlkIjoiIn0sInNpZ24iOiIyODdlZmUzZjBmMDBkZTRmNzRlMzZiOGI3ZGI1ZDRjNyJ9`
	merCode,orderId,sign,rspMsp,err := hnapay.PreParseHnapay(notifyStr)
	if err != nil {
	   beego.Debug("PreParseHnapay error:", err.Error())
	   return
	}
	beego.Debug("merCode:",merCode,"orderId:",orderId)
	for k, v := range rspMsp {
	   beego.Debug(k, v)
	}
	appKey := `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUv/SoV28tynQoWxqiyKfcmGaeijI7ZRDMg/P2xC2kDK3t/3NDzT43RDtHtvxRHXB5I7im6F3bFCK40dW6vEixDwB8pNN5OKCrtf3fMqzK7dvo8E+PQNEgoGQrdniY/ai8kriG1zVl/8hNukXKWHFj785kI/znAp9FFW/yb8EtZwIDAQAB`
	hnapay.VerifyHnapaySign(notifyStr,sign,appKey)
	
}

